/**
 *  Copyright 2009-2014 by WWW.KNET.CN  All rights reserved.
 */
package com.domain.service;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.domain.mapper.IDictMapper;
import com.domain.model.Dict;

/**
 * TODO(这里用一句话描述这个类的作用)
 * 
 * @author liujie
 * @date 2015年6月8日 下午2:25:51
 * 
 */
@Service(value = "dictService")
public class DictService {
	@Resource
	private IDictMapper dictMapper;

	public void add(Dict dict) {
		dictMapper.add(dict);
	}

	public List<Map<String, Object>> dictList() {
		return dictMapper.dictList();
	}

	public void edit(Dict dict) {
		Dict obj=dictMapper.getDictById(dict.getId());
		if (null != obj) {
			dict.setCreate_date(obj.getCreate_date());
			dict.setUser_id(obj.getUser_id());
		}
		dictMapper.edit(dict);
	}

	public Dict getDictById(Long id) {
		return dictMapper.getDictById(id);
	}

	public Dict getDictByCode(String dictCode) {
		return dictMapper.getDictByCode(dictCode);
	}

	public void delete(Long id) {
		dictMapper.delete(id);
	}
}
